<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>每日签到</title>
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
		<link rel="stylesheet" type="text/css" href="static/css/style.css">
		<script src="static/js/zepto.min.js" type="text/javascript"></script>
		<script src="static/js/flexible.js" type="text/javascript"></script>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<style> 
			.tm1 {
				background-color: white;
				opacity: 0.4;
			}

			.sfgser {
				background-color: white;
				opacity: 0.0;

			}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav tm1">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">梦回鸿蒙每日签到</h1>
		</header> 

		<!-- <div class="top-title"></div> -->
		<!--签到-->
		<div class="sign-in">
			<div class="sign-info sfgser">
				<div class="score">
					<span>+5</span>
					<span>+10</span>
					<span>+15</span>
					<span class="text-yellow">+20</span>
					<span>+25</span>
					<span>+30</span>
					<span class="text-yellow">+35</span>
				</div>
				<div class="num sign2">
					<span class="active">1</span>
					<span class="active now">2</span>
					<span>3</span>
					<span>4</span>
					<span>5</span>
					<span>6</span>
					<span>7</span>
				</div>
				<div class="date">
					<span>第1天</span>
					<span>第2天</span>
					<span>第3天</span>
					<span>第4天</span>
					<span>第5天</span>
					<span>第6天</span>
					<span>第7天</span>
				</div>
				<div class="date">
					<span>第1天</span>
					<span>第2天</span>
					<span>第3天</span>
					<span>第4天</span>
					<span>第5天</span>
					<span>第6天</span>
					<span>第7天</span>
				</div>
				<div class="date">
					<span>第1天</span>
					<span>第2天</span>
					<span>第3天</span>
					<span>第4天</span>
					<span>第5天</span>
					<span>第6天</span>
					<span>第7天</span>
				</div>
				<div class="date">
					<span>第1天</span>
					<span>第2天</span>
					<span>第3天</span>
					<span>第4天</span>
					<span>第5天</span>
					<span>第6天</span>
					<span>第7天</span>
				</div>
			</div>
			<div class="sign-btn">
				<a href="javascript:;" class="btn bg-blue" id="sign">签&nbsp;到</a>
			</div>
		</div>
		<!--说明-->  
		<div class="explain">
			<div class="title"><span>梦回鸿蒙签到说明</span></div>
		</div>
		<div class="explain-desc">
			<ul>
				<li>欢迎来到梦回鸿蒙</li>
				<li>每日签到一次，连续签到奖励更多</li>
				
			</ul>
		</div>
		
		<!--弹窗-->
		<div class="dialog">
			<div class="mask"></div>
			<div class="dialog-box">
				<div class="content">
					<p>已成功签到！</p>
					<p class="gold"><img src="static/picture/gold.png"><span class="text-blue">+8</span></p>
					<h4 >明天签到可获得8积分</h4>
				</div>
			</div>
			<div class="dialog-close"></div>
		</div>
		
		<!-- <div class="dialogx">
			<div class="mask"></div>
			<div class="dialog-box">
				<div class="content">
					<p>今天已经签到成功了！</p>
					<p class="gold"><img src="static/picture/gold.png"><span class="text-blue">+8</span></p>
					<a >明天签到可获得8积分</a>
				</div>
			</div>
			<div class="dialogx-close"></div>
		</div> -->
	</body>
</html>
<script src="../../js/mui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    var flag=true;
	mui.init();
	if(flag)
	{
		
		document.getElementById('sign').addEventListener('tap', function() {
			mui.post('http://81.70.23.51:5555/sign', {
				"flag": '1',
			}, function(data) {
				
				console.log("从服务端返回数据,准备判断");
				console.log(data.flagx);
				
					if(data.flagx=='1'){
						$('.dialog').fadeIn()
						flag=false;
					};
					if(flag)
					{
					if(data.flagx=='0')
					{
						mui.toast("梦回鸿蒙提醒您：今天已经签到过了，不要贪心哦！");
					};
					
				}
				// mui.openWindow({
				// 	url: "./login.html",
				// 	id: "./login.html",
				// 	createNew: false
				// });
			}, 'json');
		})
	};
	
	//签到
	// $('#sign').click(function(){
	// 	$('.dialog').fadeIn()
	// 	// 以下为模拟签到，具体应该根据后端返回的数据来处理逻辑
	// 	var index = $('.sign-info .num span.active').length;
	// 	console.log(index)
	// })
	// 关闭弹窗
	$('.dialog-close,.dialog .mask').click(function(){
		$('.dialog').fadeOut()
		mui.openWindow({
			createNew: true,
			url: '../../index.html', //通过URL传参
		})
	})	
	// 关闭弹窗
	// $('.dialog-close,.dialog .mask').click(function() {
	// 	$('.dialog').fadeOut()
	// })
	   //  mui.plusReady(function() {
	   // 	var primaryBack = mui.back;
	   //         mui.back = function() {
	   //            var wobj = plus.webview.getWebviewById("../index.html");   
	   //            wobj.reload(true);
	   //            primaryBack();
	   //        }
	   // })

</script>

